package com.zhentao.config;

import io.minio.MinioClient;
import lombok.Data;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;

import javax.annotation.Resource;

@Data
@EnableConfigurationProperties(MinioPojo.class)
public class MinioConfig {
    @Resource
    private MinioPojo minioPojo;

    @Bean
    public MinioClient minioClient(){
        return MinioClient.builder()
                .endpoint(minioPojo.getUrl())
                .credentials(minioPojo.getMinioName(), minioPojo.getMinioPass())
                .build();
    }
}
